#include "php_snarl.h"
#include "snarl.h"


PHP_METHOD(Snarl, showMessage)
{
	char *title;
	int title_len;
	char *message;
	int message_len;
	int timeout = 2;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &title, &title_len, &message, &message_len, &timeout) == FAILURE)
	{
		RETURN_NULL();
	}

    snarl_show_message(title, message, timeout);
}

static function_entry php_snarl_functions[] = {
    { NULL, NULL, NULL }
};

static function_entry php_snarl_snarlclass_functions[] = {
	PHP_ME(Snarl,showMessage,NULL,ZEND_ACC_PUBLIC)
    { NULL, NULL, NULL }
};

zend_class_entry *php_snarl_snarlclass_entry;
#define PHP_SNARL_SNARLCLASS_NAME "Snarl"


PHP_MINIT_FUNCTION(snarl)
{
	zend_class_entry ce;
	INIT_CLASS_ENTRY(ce, PHP_SNARL_SNARLCLASS_NAME, php_snarl_snarlclass_functions);
	php_snarl_snarlclass_entry = zend_register_internal_class(&ce TSRMLS_CC);
    return SUCCESS;
}

zend_module_entry snarl_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
     STANDARD_MODULE_HEADER,
#endif
    PHP_SNARL_EXTNAME,
    php_snarl_functions, /* Functions */
    PHP_MINIT(snarl),
    NULL, /* MSHUTDOWN */
    NULL, /* RINIT */
    NULL, /* RSHUTDOWN */
    NULL, /* MINFO */
#if ZEND_MODULE_API_NO >= 20010901
    PHP_SNARL_EXTVER,
#endif
    STANDARD_MODULE_PROPERTIES
};

#ifdef COMPILE_DL_SNARL
ZEND_GET_MODULE(snarl)
#endif